/*************************************************************************
	> File Name: P1181.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2025-02-10 15:50:34
 ************************************************************************/
#include <iostream>
using namespace std;

int main() {
    int n, m, ans = 1;
    cin >> n >> m;
    int k = 0;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (a + k <= m) {
            k += a;
        } else {
            k = a;
            ans += 1;
        }
    }
    cout << ans << endl;
    return 0;
}
